﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;

namespace Catering.UserTraining.SlrNewStaffTraining
{
    public partial class stafftraining_staff_register_add : UserIsNull
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_add_Click(object sender, EventArgs e)
        {
            int intLessonID = CommRequest.GetInt("LessionID", 0);
            int intUserID = int.Parse(this.txtUserID.Text.Trim());
            Catering_Model.NewStaffLessonsCheck _ClassLessonsCheckModel = new Catering_Model.NewStaffLessonsCheck();
            _ClassLessonsCheckModel.LessonID = intLessonID;
            _ClassLessonsCheckModel.UserID = intUserID;
            _ClassLessonsCheckModel.Remark = this.txt_Remarks.Text.Trim();
            _ClassLessonsCheckModel.IsRegister = this.rdobtn_IsRegister.SelectedValue == "0" ? false : true;
            _ClassLessonsCheckModel.AddUserID = int.Parse(Session["UserID"].ToString());
            _ClassLessonsCheckModel.AddTime = DateTime.Now;
            try
            {
                if (new Catering_Rules.NewStaffLessonsCheck().Add(_ClassLessonsCheckModel))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "Affect", "alert('保存成功！')", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "Affect", "alert('保存失败！')", true);
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "Affect", "alert('保存失败！')", true);
            }
        }
    }
}